//
//  NewListSegmentedItemCell.m
//  ShowYork
//
//  Created by hxh on 2021/1/18.
//  Copyright © 2021 hxh. All rights reserved.
//

#import "HomePageListSegmentedCell.h"

@interface HomePageListSegmentedCell ()
@property (nonatomic,strong)UIImageView *coverView;
@property (nonatomic,strong)UILabel *nameLb;
@end

@implementation HomePageListSegmentedCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setUI];
    }
    return self;
}

- (void)setUI{
    UIImage *image = [UIImage imageNamed:@"home_recommend_tag"];
    image = [image stretchableImageWithLeftCapWidth:floorf(image.size.width/2) topCapHeight:floorf(image.size.height/2)];
    self.coverView = [[UIImageView alloc]initWithImage:image];
    [self.contentView addSubview:self.coverView];
    
    [self.coverView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.left.right.equalTo(self.contentView);
    }];
    
    self.nameLb = [[UILabel alloc]init];
    self.nameLb.text = @"精选";
    self.nameLb.textColor = [UIColor whiteColor];
    self.nameLb.font = font(14);
    [self.contentView addSubview:self.nameLb];
    
    [self.nameLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(self.contentView);
    }];
}
- (void)setModel:(HomePageTagModel *)model{
    _model = model;
    self.nameLb.text = model.topicName;
        
    self.coverView.hidden = !model.isSelected;

    self.nameLb.textColor = model.isSelected?RGBA(247, 84, 112, 1):C153;
}


@end
